﻿Imports System.Data.OleDb
Public Class Login
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'If Session("UserId") = "" Then
        '    Response.Redirect("Login.aspx")
        'End If
    End Sub

    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim objBl = New BL()
        Dim dbconn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("/App_Data/KitchenCompition.mdb"))
        Dim strSelectOrder As String = "select * from Register where EmailAdd='" & txtUserId.Text & "' and UserPassword='" & txtPassword.Text & "' order by userid desc"
        Dim dtSession As DataTable = objBl.GetDataAccess(strSelectOrder, dbconn)
        If dtSession.Rows.Count > 0 Then
            Session("UserId") = dtSession.Rows(0)("UserId").ToString
            Session("EmailId") = txtUserId.Text
            Response.Redirect("myRecipe.aspx")
        Else
            lbError.Text = "Please try again"
        End If
        

    End Sub
End Class